package br.com.leilao.managebean;

import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;

import br.com.leilao.dao.PerfilDAO;
import br.com.leilao.model.Perfil;

@ManagedBean(name="perfilMB")
@SessionScoped
public class PerfilMB{


	@SuppressWarnings("unused")
	private static final long serialVersionUID = 442452923873978893L;

	public ArrayList<Perfil> listarPerfis() {
		PerfilDAO dao = new PerfilDAO();
		return dao.findAll(Perfil.class);
	}
	
	public ArrayList<SelectItem> listar() {
		PerfilDAO dao = new PerfilDAO();
		ArrayList<SelectItem> items = new ArrayList<SelectItem>();  
        for (Perfil e : dao.findAll(Perfil.class)) {  
            items.add(new SelectItem(e, e.getNome()));  
        }  
        return items;  
    }  

}
